package other;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

/**
 * @Author: Dang Qi
 * @Date: 2021/4/25 12:38
 * @Description:
 */
public class ZiXulie {
    public static void main(String[] args) {
        List<List<Integer>> ans = solve(3);
        for (List<Integer> list : ans){
            System.out.println(list);
        }
    }
    public static List<List<Integer>> solve(int n){
        List<List<Integer>> ans = new LinkedList<>();
        for(int i = 1; i <= n; i++){
            List<List<Integer>> tmp = new LinkedList<>();
            for(List<Integer> list: ans){
                List list1 = new ArrayList<>(list);
                list1.add(i);
                tmp.add(list1);
            }
            List<Integer> list = new LinkedList<>();
            list.add(i);
            ans.add(list);
            ans.addAll(tmp);
        }
        return ans;
    }

}
